<?php
error_reporting(0);
$isadmin=1; 
include_once '../../comm/config.php';
include_once '../include/page.class.php';
include_once '../../comm/checkpostandget.php';
//调用行业信息
$sql="select * from ".$BIAOTOU."malltype";
$business_res = mysql_query($sql);
if(isset($_GET['submit'])){
	$where = "";
	foreach($_GET as $k=>$v){
		if($k != 'submit'){
			if($k == 'type'){
				$v =  implode("",$v);
			}
			$where .= $k ."='". $v ."',";
		}
	}
	$where = substr($where,0,-1);
	$sqlUpdateUsershop = "update ".$BIAOTOU."usershop set {$where} where `Id`='{$_GET['id']}'";
	mysql_query($sqlUpdateUsershop);
}

//用于查询
$sql="select * from ".$BIAOTOU."usershop where Id=".$_GET['id'];
$rs = mysql_query($sql);
$row = mysql_fetch_array($rs);
//级别单个查询
$levelSql = "select * from ".$BIAOTOU."shoplevel where `id` = {$row['level']}";
$levelrs = mysql_query($levelSql);
$levelrow = mysql_fetch_array($levelrs);
//合并数组
$row = array_merge($row,$levelrow);


//print_r($row);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../js/jquery.js"></script>
<title>管理中心</title>
<link href="../css/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {
	color: #FFFFFF;
	font-weight: bold;
	font-size:14px;
	text-decoration:none;
}
.STYLE2 {
	color: #555555;
	font-weight: bold;
	font-size:14px;
	text-decoration:none;
}
-->
</style>
</head>

<body topmargin="5" leftmargin="0">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="282" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td>
          <table cellspacing="0" width="100%" height="207" style="border:1px  solid #DCEAF7;">
            <tr>
              <td height="30" colspan="2" bgcolor="E9F2FB" class="bigtext"><strong>&nbsp;<img src="../images/arrow.gif" width="16" height="22" align="absmiddle" /> 修改用户信息</strong></td>
            </tr>
            <tr>
              <td width="100%" colspan="2" valign="top"><table width="100%" height="300" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td valign="top"><form id="form1" name="form1" method="get" action="xiangxi.php">
<table width="100%"  align="center" border=1 cellpadding=0 cellspacing=0 style="border-collapse: collapse" bordercolor="#dddddd">
                      <input type="hidden" name="id" value="<?php echo $row["Id"]; ?>">
                      <tr>
                        <td height="30" align="right" class="bigtext">商户名称：</td>
                        <td height="30">&nbsp;
                        	<input type="text" name="ddshopname"  value="<?php echo $row["ddshopname"]; ?>"/>
                        </td>
                      </tr>
                      <tr>
                        <td height="30" align="right" class="bigtext">店铺编号：</td>
                        <td height="30">&nbsp;<?php echo $row["number"]; ?></td>
                      </tr>
                      <tr>
                        <td height="30" align="right" class="bigtext">用户名：</td>
                        <td height="30">&nbsp;<?php echo $row["username"]; ?>&nbsp;&nbsp;&nbsp;&nbsp;
                        <a href="#">详细</a>&nbsp; <a href="#">明细</a>
                        </td>
                      </tr>
                      <tr>
                        <td height="30" align="right" class="bigtext">会员级别：</td>
                        <td height="30">
                      		<select name="level" id="level">
                      			<?php 
	                      			//级别查询
	                      			$levelSql = "select * from ".$BIAOTOU."shoplevel";
	                      			$levelrs = mysql_query($levelSql);
                      				while($levels = mysql_fetch_array($levelrs)){
                      					if($levels['id'] == $row['level']){
                      						echo "<option selected value= {$levels['id']}>{$levels['name']}</option>";
                      					}else{
                      						echo "<option value= {$levels['id']}>{$levels['name']}</option>";
                      					}
                      				}
                      			?>
                      		</select>
                        </td>
                      </tr>
                      <tr>
                        <td height="30" align="right" class="bigtext">会员有效期：</td>
                        <td height="30">&nbsp;
                        	<?php echo $row["expiredate"]; ?>
                        </td>
                      </tr>
                      <tr>
                       	  <td height="30" align="right" class="bigtext">地区：</td>
	                      <td>
	                      	<select id="province" name="province" onchange="change_city(this.value);" >
								<option <?php echo ($row["province"] == "北京")?"selected":"";?> value="北京">北京</option>
							    <option <?php echo ($row["province"] == "上海")?"selected":"";?> value="上海">上海</option>
							    <option <?php echo ($row["province"] == "天津")?"selected":"";?> value="天津">天津</option>
							    <option <?php echo ($row["province"] == "重庆")?"selected":"";?> value="重庆">重庆</option>
							    <option <?php echo ($row["province"] == "河北")?"selected":"";?> value="河北">河北</option>
							    
							    <option <?php echo ($row["province"] == "山西")?"selected":"";?>  value="山西">山西</option>
							    <option <?php echo ($row["province"] == "内蒙古")?"selected":"";?>  value="内蒙古">内蒙古</option>
							    <option <?php echo ($row["province"] == "辽宁")?"selected":"";?> value="辽宁">辽宁</option>
							    <option <?php echo ($row["province"] == "吉林")?"selected":"";?>  value="吉林">吉林</option>
							    <option <?php echo ($row["province"] == "黑龙江")?"selected":"";?> value="黑龙江">黑龙江</option>
							    
							    <option <?php echo ($row["province"] == "江苏")?"selected":"";?>  value="江苏">江苏</option>
							    <option <?php echo ($row["province"] == "浙江")?"selected":"";?>  value="浙江">浙江</option>
							    <option <?php echo ($row["province"] == "安徽")?"selected":"";?>  value="安徽">安徽</option>
							    <option <?php echo ($row["province"] == "福建")?"selected":"";?>  value="福建">福建</option>
							    <option <?php echo ($row["province"] == "江西")?"selected":"";?>  value="江西">江西</option>
							    
							    <option <?php echo ($row["province"] == "山冻")?"selected":"";?>  value="山冻">山东</option>
							    <option <?php echo ($row["province"] == "河南")?"selected":"";?>  value="河南">河南</option>
							    <option <?php echo ($row["province"] == "湖北")?"selected":"";?>  value="湖北">湖北</option>
							    <option <?php echo ($row["province"] == "广东")?"selected":"";?>  value="广东">广东</option>
							    <option <?php echo ($row["province"] == "四川")?"selected":"";?>  value="四川">四川</option>
							    
							    <option <?php echo ($row["province"] == "贵州")?"selected":"";?> value="贵州">贵州</option>
							    <option <?php echo ($row["province"] == "云南")?"selected":"";?> value="云南">云南</option>
							    <option <?php echo ($row["province"] == "西藏")?"selected":"";?> value="西藏">西藏</option>
							    <option <?php echo ($row["province"] == "陕西")?"selected":"";?> value="陕西">陕西</option>
							    <option <?php echo ($row["province"] == "甘肃")?"selected":"";?> value="甘肃">甘肃</option>
							    
							    <option <?php echo ($row["province"] == "宁夏")?"selected":"";?>  value="宁夏">宁夏</option>
							    <option <?php echo ($row["province"] == "青海")?"selected":"";?>  value="青海">青海</option>
							    <option <?php echo ($row["province"] == "新疆")?"selected":"";?>  value="新疆">新疆</option>
						  	</select>&nbsp;&nbsp;&nbsp;&nbsp;
						    <select id="city" name="city">
							    <option value="">全部城市</option>
							    <?php echo (isset($row["city"]))?"<option selected value='".$row['city']."'>".$row['city']."</option>":"";?>
						    </select>
	                      </td>
	                  <tr>
                        <td height="30" align="right" class="bigtext">详细地址：</td>
                        <td height="30">&nbsp;
                        	<input type="text" name="address"  value="<?php echo $row["address"];?>"/>
                        </td>
                      </tr>
                      <tr>
                        <td height="30" align="right" class="bigtext">邮编：</td>
                        <td height="30">&nbsp;
                        	<input type="text" name="zip"  value="<?php echo $row["zip"];?>"/>
                        </td>
                      </tr>
                      <tr>
                      	<td height="30" align="right" class="bigtext">行业：</td>
                      	<td>
	                      	<select id="business" name="business">
							    <?php 
								    while ($busres = mysql_fetch_array($business_res)){
								    	if($row['business'] == $busres["typename"]){
								    		echo "<option value=".$busres["typename"]." selected='selected'>".$busres["typename"]."</option>";
								    	}else{
								    		echo "<option value=".$busres["typename"].">".$busres["typename"]."</option>";
								    	}
								    }
							    ?>
							</select>
                      	</td>
                      </tr>
                      <tr>
                      	<td height="30" align="right" class="bigtext">店铺类型：</td>
                      	<td>
	                      	<input <?php echo (strstr($row['type'],'1'))?"checked":"";?> name="type[]" type="checkbox" value="1" class="FLeft check" align="middle"><span class="FLeft">实体店</span>
							<input <?php echo (strstr($row['type'],'2'))?"checked":"";?> name="type[]" type="checkbox" value="2" class="FLeft check" align="middle"><span class="FLeft">网店</span>
							<input <?php echo (strstr($row['type'],'3'))?"checked":"";?> name="type[]" type="checkbox" value="3" class="FLeft check" align="middle"><span class="FLeft">厂家</span>
                      	</td>
                      </tr>
                      <tr>
                        <td height="30" align="right" class="bigtext">网站：</td>
                        <td height="30">&nbsp;
                        	http://<input type="text" name="url"  value="<?php echo $row['url']?>"/>
                        </td>
                      </tr>
                       <tr>
                        <td height="30" align="right" class="bigtext">联系人：</td>
                        <td height="30">&nbsp;
                        	<input type="text" name="contact_username"   value="<?php echo $row['contact_username']?>"/>
                        </td>
                      </tr>
                       <tr>
                        <td height="30" align="right" class="bigtext">手机号：</td>
                        <td height="30">&nbsp;
                        	<input type="text" name="contact_mobile"  value="<?php echo $row['contact_mobile']?>"/>
                        </td>
                      </tr>
                       <tr>
                        <td height="30" align="right" class="bigtext">电话：</td>
                        <td height="30">&nbsp;
                        	<input type="text" name="tel"  value="<?php echo $row["tel"];?>"/>
                        </td>
                      </tr>
                       <tr>
                        <td height="30" align="right" class="bigtext">店铺邮箱：</td>
                        <td height="30">&nbsp;
                        	<?php echo $row['username']?>
                        </td>
                      </tr>
                       <tr>
                        <td height="30" align="right" class="bigtext">开店时间：</td>
                        <td height="30">&nbsp;<?php echo $row['regtime']?></td>
                      </tr>
                       <tr>
                        <td height="30" align="right" class="bigtext">发放米票：</td>
                        <td height="30">&nbsp;
                        </td>
                      </tr>
                       <tr>
                        <td height="30" align="right" class="bigtext">累计发放：</td>
                        <td height="30">&nbsp;
                        </td>
                      </tr>
                       <tr>
                        <td height="30" align="right" class="bigtext">店铺公告：</td>
                        <td height="30">&nbsp;
                         	<textarea cols="50" rows="10" name="announcement"><?php echo $row["announcement"];?></textarea>
                        </td>
                      </tr>
                     <tr>
                        <td height="50" align="center" class="bigtext">&nbsp;</td>
                        <input type="hidden" name="submit">
                        <td height="50" class="bigtext">&nbsp;<input type="submit" value=" 修改用户资料 " /></td>
					   </tr>
                    </table>
                                    <br />
                  </form>
                  </td>
                </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
      
    </table></td>
  </tr>
</table>
<script>
function change_city(province){
	$("#city").html("<option value=''>请选择市</option>");
    switch (province) {
		case "北京" :var cityOptions = new Array("北京");
			break;	
		case "上海" :var cityOptions = new Array("上海");
			break;	
		case "天津" :var cityOptions = new Array("天津");
			break;	
		case "重庆" :var cityOptions = new Array("重庆");
			break;	
		case "河北" :
			var cityOptions = new Array("石家庄","张家口","承德","唐山","廊坊","保定","沧州","衡水","邢台","邯郸");	break;	
		case "山西" :
			var cityOptions = new Array("太原","大同","朔州","阳泉","长治","晋城","忻州","离石","榆次","临汾","运城");	break;	
		case "内蒙古" :
			var cityOptions = new Array("呼和浩特","包头","乌海","赤峰","海拉尔","乌兰浩特","通辽","锡林浩特","集宁","东胜","临河","阿拉善左旗","鄂尔多斯");	break;			
		case "辽宁" :
			var cityOptions = new Array("沈阳","朝阳","阜新","铁岭","抚顺","本溪","辽阳","鞍山","丹东","大连","营口","盘锦","锦州","葫芦岛");
			 break;  
		case "吉林" :
			var cityOptions = new Array("长春","白城","松原","吉林","四平","辽源","通化","白山","延吉");		
		case "黑龙江" :
			var cityOptions = new Array("哈尔滨","齐齐哈尔","黑河","大庆","伊春","鹤岗","佳木斯","双鸭山","七台河","鸡西","牡丹江","绥化","加格达奇");break;	
		case "江苏" :
			var cityOptions = new Array("南京","苏州","徐州","连云港","宿迁","淮安","盐城","扬州","泰州","镇江","常州","无锡");
			break;	
		case "浙江" :
			var cityOptions = new Array("杭州","湖州","嘉兴","舟山","宁波","绍兴","金华","台州","温州","丽水","衢州");
			break;	
		case "安徽" :
			var cityOptions = new Array(
			"合肥", "宿州", "淮北", "阜阳", "蚌埠", "淮南", "滁州", "马鞍山", "芜湖", "铜陵", "安庆", "黄山", "六安", "巢湖", "贵池", "宣城", "亳州");			break;	
		case "福建" :
			var cityOptions = new Array("福州", "南平", "三明", "莆田", "泉州", "厦门", "漳州", "龙岩", "宁德", "福安", "邵武", "石狮", "永安", "武夷山", "福清");	
			break;	
		case "江西" :
			var cityOptions = new Array("南昌", "九江", "景德镇", "鹰潭", "新余", "萍乡", "赣州", "上饶", "临川", "宜春", "吉安", "抚州");
			break;	
		case "山东" :
			var cityOptions = new Array("聊城", "德州", "东营", "淄博", "潍坊", "烟台", "威海", "青岛", "日照", "临沂", "枣庄", "济宁", "泰安", "莱芜", "滨州", "菏泽");
			break;					
		case "河南" :
			var cityOptions = new Array("郑州", "三门峡", "洛阳", "焦作", "新乡", "鹤壁", "安阳", "濮阳", "开封", "商丘", "许昌", "漯河", "平顶山", "南阳", "信阳", "济源", "周口", "驻马店");	
			break;					
		case "湖北" :
			var cityOptions = new Array("武汉", "十堰",  "襄樊", "荆门",  "孝感",  "黄冈", "鄂州",  "黄石", "咸宁", "荆州", "宜昌",  "恩施", "仙桃", "潜江",  "随州", "广水", "天门");
			break;				
		case "湖南" :
			var cityOptions = new Array("长沙", "张家界", "常德", "益阳", "岳阳", "株洲", "湘潭", "衡阳", "郴州",  "永州", "邵阳", "怀化", "娄底", "吉首" );break;
		case "广东" :
			var cityOptions = new Array("广州", "深圳",  "清远", "韶关", "河源",  "梅州",  "潮州",  "汕头", "揭阳", "汕尾",  "惠州", "东莞",  "珠海", "中山",  "江门", "佛山",  "茂名",  "湛江",  "阳江", "云浮",  "肇庆");
			break;
		case "广西" :
			var cityOptions = new Array("南宁", "桂林", "柳州",  "贺州", "玉林", "钦州", "北海", "防城港", "百色", "河池", "贵港", "梧州");
			break;			
		case "海南" :
			var cityOptions = new Array("海口",  "三亚", "儋州");
			break;				
		case "四川" :
			var cityOptions = new Array("成都", "广元", "绵阳", "德阳", "南充", "广安", "遂宁",  "内江", "乐山", "自贡", "泸州", "宜宾", "攀枝花", "巴中", "达州", "资阳", "雅安", "西昌", "眉山", "泸定");
			break;				
		case "贵州" :
			var cityOptions = new Array("贵阳", "六盘水", "遵义", "毕节", "铜仁", "安顺", "凯里", "都匀", "兴义");
			break;			
		case "云南" :
			var cityOptions = new Array("昆明", "曲靖", "玉溪", "丽江",  "昭通", "思茅", "临沧", "保山", "潞西", "泸水", "中甸", "大理", "楚雄", "个旧", "文山", "景洪", "红河");
			break;				
		case "西藏" :
			var cityOptions = new Array( "拉萨", "那曲", "昌都",  "林芝", "乃东", "日喀则", "噶尔");
			break;				
		case "陕西" :
			var cityOptions = new Array( "西安", "延安", "铜川",  "渭南", "咸阳", "宝鸡", "汉中",  "榆林", "商洛", "安康");
			break;				
		case "甘肃" :
			var cityOptions = new Array( "兰州", "嘉峪关", "白银", "天水",  "酒泉", "张掖",  "金昌", "庆阳", "平凉", "定西", "陇南", "临夏", "武威");
			break;			
		case "宁夏" :
			var cityOptions = new Array( "银川",  "石嘴山", "吴忠", "固原");
			break;				
		case "青海" :
			var cityOptions = new Array( "西宁", "平安", "海晏",  "共和", "同仁", "玛沁", "玉树", "德令哈");
			break;		
		case "新疆" :
			var cityOptions = new Array( "乌鲁木齐", "克拉玛依", "石河子",  "喀什",   "阿克苏",  "和田",  "吐鲁番", "哈密", "阿图什", "博乐", "昌吉", "库尔勒",  "伊犁", "奎屯", "塔城",  "阿勒泰");
			break;	
		default:
			var cityOptions = new Array("北京");
			break;
	} 
	for(var i = 0; i < cityOptions.length; i++){
		var option = "<option value='"+cityOptions[i]+"'>"+cityOptions[i]+"</option>";  
		$("#city").append(option);  
	} 
}  
</script>
</body>
</html>
<?php mysql_close($link);?>
